-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for creating self-decrypting binaries #2315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
e684dcc
to
4c7b909
Compare
4c7b909
to
fd83496
Compare
…e examples compilation passes
…e examples compilation passes
For now, this function embeds the decrypting bootloader, but probably better to integrate (or replace) existing pico_encrypt_binary function
Add newlines for readability, and explain why MbedTLS version is insecure
c0f179f
to
fdc61ca
Compare
# This sets the target properties PICOTOOL_AESFILE to AESFILE, PICOTOOL_IVFILE to IVFILE, and | ||
# PICOTOOL_ENC_SIGFILE to SIGFILE if specified, else PICOTOOL_SIGFILE. | ||
# | ||
# Optionally, use EMBED to embed a decryption stage into the encrypted binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another stupid question: when/why would you not want to embed a decryption stage into the encrypted binary?
# and takes up more code size. | ||
# This sets the target property PICOTOOL_USE_MBEDTLS_DECRYPTION to TRUE. | ||
# | ||
# Optionally, use OTP_KEY_PAGE to specify the OTP page storing the AES key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have some default or implicit value, if not explicitly set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this same OTP page (or some fixed offset from it) also used for storing the IV salt, or might it make sense to have an OTP_SALT_PAGE
parameter?
The embedded decryption stage only works if the binary is written to Flash and then loaded to SRAM by the bootrom
This adds extra functionality to the
pico_encrypt_binary
function to allow creating self-decrypting binaries, including specifying the OTP page to use for the AES key.The main non-backwards-compatible change is the addition of a new IV salt bin file which is required and must be passed as the second argument. This will break any uses of
pico_encrypt_binary
, and has been added for security purposes, as we now salt the public IV with a salt stored in OTP.The other non-backwards-compatible change it that if you previously called:
you now need to call
due to the new argument parsing. I think that this is fine, because the only time you'd pass a separated
SIGFILE
topico_encrypt_binary
is when you're using a different signing key for the binary vs the encrypted blob, which is not a common use case.This PR requires use of the picotool encrypted-shares branch (raspberrypi/picotool#207), so should be merged after that.